FROM golang:1.20.4-alpine3.18 AS builder

WORKDIR /build

ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOPROXY https://goproxy.cn,direct
ENV GOARCH amd64

COPY go.mod .
#COPY go.sum .
RUN go mod download
COPY . .
RUN go mod tidy

RUN go build -ldflags="-s -w" -o app cmd/app.go

FROM alpine

WORKDIR /build

ENV TZ Asia/Shanghai

COPY --from=builder /build/app .
WORKDIR /
COPY conf/ /conf


EXPOSE 20001

CMD ["./build/app"]

